/*
 * "TaringaError.java" is part of Tarinca-COA
 * (http://code.google.com/p/taringa-api/)
 * Copyright (C) - 2010 Juan B Cabral <jbc dot develop at gmail dot com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package taringa;

/**
 * Wrapper para los errores de Taringa.
 *
 * Errores:
 *     code 0: Invalid Response
 *
 *     code 1: Method missing
 *     code 2: Invalid API key
 *     code 3: Invalid format
 *     code 4: Invalid method
 *     code 5: Missing parameters
 *     code 6: Bad User nickname
 *     code 7: Invalid parameter
 *     code 8: No data
 *     code 9: Post deleted
 *     code 10: Private post
 *     code 11: Rate Limiting Exceeded
 *
 *     code 1000 : Unknown error
 *
 * @version 0.2
 * @license LGPL3
 * @author JBC
 * @since 0.2
 * @date 2010-02-13
 */
public final class TaringaError extends RuntimeException {

    private long code;

    protected TaringaError(String message, long code) {
        super(message);
        this.code = code;
    }

    protected TaringaError(String message, long code, StackTraceElement[] st) {
        this(message, code);
        this.setStackTrace(st);
    }

    @Override
    public String toString() {
        return super.getMessage() + " - Error Code: " + this.code;
    }

    public long getCode() {
        return code;
    }
}
